package com.jrh.biz.comments;

import java.util.List;

import com.jrh.dal.CommentsDao;
import com.jrh.domain.entity.Comments;

/**
 * 评论服务实现
 * 
 * @author yout 2012-7-17 下午10:00:19
 */
public class CommentsServiceImpl implements CommentsService {

    private CommentsDao commentsDao;

    public void setCommentsDao(CommentsDao commentsDao) {
        this.commentsDao = commentsDao;
    }

    @Override
    public void addComments(Comments comments) {
        commentsDao.create(comments);
    }

    @Override
    public void deleteComments(long id) {
        commentsDao.delete(id);
    }

    @Override
    public List<Comments> listCommentsByRefIdAndType(long refId, String refType) {
        Comments c = new Comments();
        c.setRefId(refId);
        c.setRefType(refType);
        return commentsDao.listCommentsByCondition(c);
    }

    @Override
    public List<Comments> listCommentsByCondition(Comments comments) {
        return commentsDao.listCommentsByCondition(comments);
    }
}
